home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
DELPHI32
/
BUTTONS
/
XTOOLBTN
/
UNIT7.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-06-08
|
1KB
|
67 lines
unit Unit7;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
xToolBtn, Buttons;
type
TfrmButtons = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
procedure ButtonClick(Sender: TObject);
public
{ Public declarations }
end;
var
frmButtons: TfrmButtons;
implementation
{$R *.DFM}
procedure TfrmButtons.FormCreate(Sender: TObject);
const
perLine = 20;
aWidth = 25;
aSpace = 2;
var
aBtn : TxToolButton;
Button : TButtonBmp;
begin
for Button := Low(TButtonBmp) to High(TButtonBmp) do
begin
aBtn:=TxToolButton.Create(Self);
aBtn.Parent:=Self;
aBtn.Button:=Button;
aBtn.Left := aSpace + (Ord(Button) mod perLine) * aWidth;
aBtn.Top := aSpace + (Ord(Button) div perLine) * aWidth;
aBtn.Hint := ButtonToString(Button);
aBtn.OnClick := ButtonClick;
end;
ClientWidth := aSpace*2+(perLine*aWidth);
ClientHeight:= aSpace*2+(10*aWidth);
end;
procedure TfrmButtons.ButtonClick(Sender: TObject);
begin
Close;
end;
procedure TfrmButtons.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_ESCAPE then
begin
Key:=0;
Close;
end;
end;
end.